import request from '@/config/axios'

// 课题信息主 VO
export interface TopicInformationVO {
  // 主键
  id: number
  // 论文题目
  title: string
  // 简介
  summary: string
  // 负责老师
  teacherName: string
  // 老师手机号
  teacherId: number
  // 学生手机号
  studentId: number
  // 学生名字
  studentName: string
  // 专业
  major: string
  // 院系编号
  deptId: number
  // 用户手机号，对应的学生手机号
  userId: number
}

// 课题信息主 API
export const TopicInformationApi = {
  // 查询课题信息主分页
  getTopicInformationPage: async (params: any) => {
    return await request.get({ url: `/paper/topic-information/page`, params })
  },

  // 查询课题信息主详情
  getTopicInformation: async (id: number) => {
    return await request.get({ url: `/paper/topic-information/get?id=` + id })
  },

  // 新增课题信息主
  createTopicInformation: async (data: TopicInformationVO) => {
    return await request.post({ url: `/paper/topic-information/create`, data })
  },

  // 修改课题信息主
  updateTopicInformation: async (data: TopicInformationVO) => {
    return await request.put({ url: `/paper/topic-information/update`, data })
  },

  // 删除课题信息主
  deleteTopicInformation: async (id: number) => {
    return await request.delete({ url: `/paper/topic-information/delete?id=` + id })
  },

  // 导出课题信息主 Excel
  exportTopicInformation: async (params) => {
    return await request.download({ url: `/paper/topic-information/export-excel`, params })
  },

// ==================== 子表（成果） ====================

  // 获得成果分页
  getAchievementPage: async (params) => {
    return await request.get({ url: `/paper/topic-information/achievement/page`, params })
  },
  // 新增成果
  createAchievement: async (data) => {
    return await request.post({ url: `/paper/topic-information/achievement/create`, data })
  },

  // 修改成果
  updateAchievement: async (data) => {
    return await request.put({ url: `/paper/topic-information/achievement/update`, data })
  },

  // 修改成果状态
  updateAchievementStatus: async (data) => {
    return await request.put({ url: `/paper/topic-information/achievement/updateStatus`, data })
  },

  // 删除成果
  deleteAchievement: async (id: number) => {
    return await request.delete({ url: `/paper/topic-information/achievement/delete?id=` + id })
  },

  // 获得成果
  getAchievement: async (id: number) => {
    return await request.get({ url: `/paper/topic-information/achievement/get?id=` + id })
  },

// ==================== 子表（任务书） ====================

  // 获得任务书分页
  getAssignmentPage: async (params) => {
    return await request.get({ url: `/paper/topic-information/assignment/page`, params })
  },
  // 新增任务书
  createAssignment: async (data) => {
    return await request.post({ url: `/paper/topic-information/assignment/create`, data })
  },

  // 修改任务书
  updateAssignment: async (data) => {
    return await request.put({ url: `/paper/topic-information/assignment/update`, data })
  },

  // 修改任务书状态
  updateAssignmentStatus: async (data) => {
    return await request.put({ url: `/paper/topic-information/assignment/updateStatus`, data })
  },

  // 删除任务书
  deleteAssignment: async (id: number) => {
    return await request.delete({ url: `/paper/topic-information/assignment/delete?id=` + id })
  },

  // 获得任务书
  getAssignment: async (id: number) => {
    return await request.get({ url: `/paper/topic-information/assignment/get?id=` + id })
  },

// ==================== 子表（开题报告） ====================

  // 获得开题报告分页
  getOpeningReportPage: async (params) => {
    return await request.get({ url: `/paper/topic-information/opening-report/page`, params })
  },
  // 新增开题报告
  createOpeningReport: async (data) => {
    return await request.post({ url: `/paper/topic-information/opening-report/create`, data })
  },

  // 修改开题报告
  updateOpeningReport: async (data) => {
    return await request.put({ url: `/paper/topic-information/opening-report/update`, data })
  },

  // 修改开题报告状态
  updateOpeningReportStatus: async (data) => {
    return await request.put({ url: `/paper/topic-information/opening-report/updateStatus`, data })
  },


  // 删除开题报告
  deleteOpeningReport: async (id: number) => {
    return await request.delete({ url: `/paper/topic-information/opening-report/delete?id=` + id })
  },

  // 获得开题报告
  getOpeningReport: async (id: number) => {
    return await request.get({ url: `/paper/topic-information/opening-report/get?id=` + id })
  },

// ==================== 子表（论文） ====================

  // 获得论文分页
  getManuscriptPage: async (params) => {
    return await request.get({ url: `/paper/topic-information/manuscript/page`, params })
  },
  // 新增论文
  createManuscript: async (data) => {
    return await request.post({ url: `/paper/topic-information/manuscript/create`, data })
  },

  // 修改论文
  updateManuscript: async (data) => {
    return await request.put({ url: `/paper/topic-information/manuscript/update`, data })
  },

  // 修改论文状态
  updateManuscriptStatus: async (data) => {
    return await request.put({ url: `/paper/topic-information/manuscript/updateStatus`, data })
  },

  // 删除论文
  deleteManuscript: async (id: number) => {
    return await request.delete({ url: `/paper/topic-information/manuscript/delete?id=` + id })
  },

  // 获得论文
  getManuscript: async (id: number) => {
    return await request.get({ url: `/paper/topic-information/manuscript/get?id=` + id })
  },
}
